package org.duang.plugins;

import java.util.HashMap;
import java.util.Map;

import org.duang.config.Config;
import org.duang.db.Connection;
import org.duang.db.sql.Sql;
import org.duang.kit.SqlKit;

public class SqlPlugin implements IPlugin {

	@SuppressWarnings("static-access")
	public void start() throws Exception{
		Map<String, String> optionMap = new HashMap<String,String>();
		optionMap.put(Connection.URL_FIELD, Config.getSqlUrl());
		optionMap.put(Connection.USERNAME_FIELD, Config.getSqlDBUserName());	
		optionMap.put(Connection.PASSWORD_FIELD, Config.getSqlDBPassword());	
		Sql.getInstance().connect(optionMap);
		SqlKit.getAllTable();
	}

	public void stop() throws Exception{
		Sql.download();
	}

}
